package descentFly.app.social
{
	import descentFly.df_spaceObject;
	import descentFly.server.df_servers;
	
	import flash.events.IEventDispatcher;
	
	public class df_defSocial extends df_spaceObject implements ISocial {
		
		private var _user: Object;
		
		public function df_defSocial(userUID: uint) {
			super();
			userInit(userUID);
		}
		
		public static function randomUID(): uint {
			return Math.round(Math.random() * uint.MAX_VALUE); 
		}
		
		protected function userInit(userUID: uint): void {
			user = {
				uid		: userUID,
				name	: 'noname'
			}
		}
		
		public function getUserFromObj(user	: Object, retFunc: Function): void {
			if ((user is Number) || (user is String)) retFunc({
				uid		: user, 
				name	: 'noname'
			}) else retFunc(user);
		}
		
		protected function setUser(a_user: Object): void {
			_user = a_user;
		}
		
		public function getUserTitle(user: Object, retFunc: Function): void { 
			retFunc(user.uid + ' noname');
		}

		public function getUserImage(user: Object, retFunc: Function): void { 
			retFunc(images.DEFAULT_LOGO);
		}

		public function set user(a_user: Object): void {
			setUser(a_user);
		}
		
		public function get images(): Object {
			return {
				DEFAULT_LOGO	: df_servers.DATA_URL + 'images/50/nophoto.png',
				SYSNOTIFY		: df_servers.DATA_URL + 'images/50/sysnotify.png'
			}
		}
		
		public function get loginEnable(): Boolean {
			return true;
		}
		
		public function get user(): Object {
			return _user;
		}
	}
}